# coding=utf-8

import requests
import json
import urllib3
urllib3.disable_warnings()

url1 = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=wwd9f2daef41d58e5d&corpsecret=T35AJ5_m4BJtYo9cutLa2OGC-NuPKZx2JP5RJ_3xXLk"
result = requests.get(url1, verify=False).json()
access_token = result['access_token']

def get_bumen():
    url = "https://qyapi.weixin.qq.com/cgi-bin/department/list?access_token={}&id=1".format(access_token)
    result1 = requests.get(url, verify=False).json()
    print(result1)

def get_chengyuan():
    url = "https://qyapi.weixin.qq.com/cgi-bin/user/simplelist?access_token={}&department_id={}".format(access_token,"1")
    result2 = requests.get(url, verify=False).json()
    print(json.dumps(result2, ensure_ascii=False))
def get_user():
    url = "https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token={}&userid={}".format(access_token, 'WangShaoBo')
    result = requests.get(url, verify=False).json()
    print(json.dumps(result, ensure_ascii=False))










if __name__ == '__main__':
    get_user()